package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

/**
 * @Author wpj
 * @Date 2020/10/5
 */
@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_CHOOSE_NEXT_POINT, desc = "选择下一个坐标")
public class CrossChooseNextPointCmd extends CrossCommand {

    int x;
    int y;
    int activityId;
    List<Integer> patronsList;
    int goldenKeyNum;
    UserBaseInfo userBaseInfo;

    long totalAbility;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.CrossChooseNextPointReqMsg msg = HuaShiGangProto.CrossChooseNextPointReqMsg.parseFrom(packet.getBytes());
        x = msg.getX();
        y = msg.getY();
        activityId = msg.getActivityId();
        patronsList = msg.getPatronsIdList();
        goldenKeyNum = msg.getGoldenKeyNum();
        userBaseInfo = PlayerBasePb.parseToUserBaseInfo(msg.getPlayerBaseInfo());
        totalAbility = msg.getTotalAbility();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HuaShiGangMgr.chooseNextPoint(activityId, serverId, packet.getPlayerId(), x, y, patronsList, goldenKeyNum, userBaseInfo, totalAbility);
    }

    @Override
    public void sendData() {

    }
}
